<?php

namespace App\Admin\Renderable;


use App\Admin\Actions\Grid\GoodsOrder\Logistics;
use App\Models\GoodsLogistic;
use Dcat\Admin\Grid;
use Dcat\Admin\Grid\LazyRenderable;

class LogisticsTable extends LazyRenderable
{

    public function grid(): Grid
    {
        return Grid::make(new GoodsLogistic(), function (Grid $grid) {
            $grid->setActionClass(Grid\Displayers\Actions::class);
            $good_order_id = $this->payload['good_order_id'];
            $grid->model()->with('goodOrder')->where('good_order_id', '=', $good_order_id) ->orderBy('time');

            $grid->column('message',trans('goods-logistic.fields.message'));
            $grid->column('time',trans('goods-logistic.fields.time'));

            $grid->disableFilterButton();
            //$grid->disableRowSelector();
            //$grid->disableCreateButton();
            //$grid->disableActions();
            $grid->disableFilterButton();
            $grid->showQuickEditButton();
            $grid->showRowSelector();
            $grid->showDeleteButton();
            $grid->showActions();
            // 显示批量删除按钮
            $grid->showBatchDelete();
            $grid->quickCreate(function (Grid\Tools\QuickCreate $create) {
                $create->text('name', '名称');
                $create->email('email', '邮箱');
            });

        });
    }
}
